Chatbot 101

3 min read

In this article, I’m going to talk about the basic things you need to know before you get your hands dirty on developing chatbots. 

Chatbots, what a fancy word you hear these days almost everywhere. 

First, I would like to give a basic idea of what is a chatbot. 

At the most basic level, a chatbot is a computer program that simulates and processes human conversation (either written or spoken), allowing humans to interact with digital devices as if they were communicating with a real person.

In a simple form, a chatbot is a computer software that simulates human conversation as written form or spoken form. So when someone is building a chatbot, his/her main goal is to develop a software that responds to human natural language.

In the world of chatbots, there are several buzzwords that you need to learn when you are on-boarding to the journey of chatbot development. You may have heard some of it already. 

Intent 

What is an intent? — The intention of the user input or the purpose of the user’s input. When you develop your bot, you need to define these intents for your bot. Let’s take this small dialogue as an example.

😃-What time is it? ( Intent — Ask for time )

🤖-It is 11:08?

I know this is not a question that you ask from a bot, but I took it because it is easy to learn from this example. In the above dialogue, the user’s intention is to know the current time. So for that question, you define the intent as “ask for time”. 

When you develop chatbot, you need to provide examples so that it can learn from the examples and perform better by providing more human-like behavior. So we provide a set of examples along with the intent like below.

Intent — Ask for time

Examples — 

  • What time is it?
  • What is the current time?
  • Tell me the current time?
  • Can you tell me what time is it?
  • Time, please?

The way you define examples and intent deffer from framework to framework. But the general idea is the same. 

TLTR: Intent means user’s intention (Underlying meaning or purpose of the user ) When we develop chatbots, we need to provide a set of examples along with their intents.

Entity 

An entity can be defined as extra information for the intent. Let’s take below sentence as an example.

What is the capital of Sri Lanka?

In the above example, intent can be “Ask for capital” and entities are “capital” and “Sri Lanka” 

Webhooks 

Webhooks is not unique to chatbots, but it is very useful to provide additional actions. Webhooks are similar to APIs, But in APIs, a request is made and you parse through the response for the data you want and in webhooks, no request is required for a webhook. In webhook, when required data are available, you just send it as a POST request. We use webhooks in chatbots to provide additional actions such as API calls for some other service, sent calls for payment gateways, predict something using a model etc.

Your bot doesn’t have to be just a chatty assistant. It can also handle more advanced actions for you such as completing purchases, sending receipts and sending updated data from your databases. You can do that using webhooks.

Response 

Anything the bot says in response to user input.

Word of advice for beginners

When you develop your chatbot, you need to train your chatbot by providing more data. In other words, you need to provide examples for your bot so that your bot can perform more accurately. One of the big mistakes that people do is that they don’t provide enough examples for the bot. Then they complain the bot is not working properly. Adding a significant number of example for your bot is a MUST. 

Make sure that you define entities and intents correctly. If not, you will not get the expected result with good accuracy. 

Always think about your users. Manage your scopes and context wisely. Users will expect you to conserve the context of the conversation.

Think about follow up intents. Follow up intents are basically intent that can come after a certain intent.

Imagine a scenario like this, the user wants to find a Japanese cuisine restaurant in London. In here the bot needs to extract two entities from the user. But the user only provided one. The user only asked for a Japanese cuisine restaurant and he/she doesn’t specify the location. At this point, your bot should be able to ask the missing information from the user. These types of scenarios should be considered when you develop your chatbot. The way you should handle different scenario may differ from chatbot platform to platform. 

Users always expect human-like behavior from a bot and building a bot with some charm and humor will almost certainly improve the user experience. Another good practice is that if the user’s question doesn’t fit the scope of your bot, don’t be afraid to mention without providing false or inefficient answers.

Dushan Devinda I'm a software engineer at Chain Analytica. Machine Learning and Data Science enthusiast. I'm a Computer Science graduate at General Sir John Kotelawala Defence University Sri Lanka. As a hobby, I write technical blogs.

One Reply to “Chatbot 101”

Leave a Reply

Your email address will not be published. Required fields are marked *